#include('header.html', {title: '重置密码'})

<div id="content-container" class="container">
    <div class="row row-6">
        <div class="col-md-6 col-md-offset-3 ptl">
            <div class="panel panel-default panel-page">
                <div class="panel-heading"><h2>重设密码</h2></div>
                <ul class="nav nav-tabs mbl js-find-password">
                    <!--<li class="js-find-by-email active">-->
                        <!--<a style="cursor: pointer;">邮箱地址</a>-->
                    <!--</li>-->
                    <!--<li class="js-find-by-mobile">-->
                    <!--<a style="cursor: pointer;">手机号码</a>-->
                    <!--</li>-->
                </ul>
                <form id="password-reset-form" @submit.prevent="find_" class="form-vertical" method="post" novalidate="novalidate">
                    <div class="form-group">
                        <label class="control-label" for="form_email" aria-required="true">邮箱地址</label>
                        <div class="controls">
                            <input type="email" id="form_email" name="" v-model="user.email" class="form-control"
                                   required="required">
                            <p class="help-block">请输入你在注册时填写的邮箱地址</p>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="form_email" aria-required="true">账号</label>
                        <div class="controls">
                            <input type="text" id="form_name" name="" v-model="user.username" class="form-control"
                                   required="required">
                            <p class="help-block">请输入你在注册时填写的邮箱地址对应的账号</p>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="controls">
                            <button type="submit" class="btn btn-primary"
                                    data-loading-text="正在发送重设密码邮件...">重设密码
                            </button>
                        </div>
                    </div>
                    <input type="hidden" name="_csrf_token" value="ZOwpJgi5H9Nm9-wMt0iYsTK3Vp-FXwzLD_sl4J5YPLc">
                </form>

                <!--<form id="password-reset-by-mobile-form" class="form-vertical hide" action="#" method="post"-->
                <!--novalidate="novalidate">-->
                <!--<div class="form-group">-->
                <!--<label class="control-label required" for="mobile" aria-required="true">手机号码</label>-->
                <!--<div class="controls">-->
                <!--<input type="text" id="mobile" name="mobile" data-url="/password/reset/check/mobile" class="form-control"-->
                <!--data-role="mobile">-->
                <!--</div>-->
                <!--</div>-->
                <!--<div class="form-group">-->
                <!--<label class="control-label required" for="sms-code" aria-required="true">短信验证码</label>-->
                <!--<div class="controls row">-->
                <!--<div class="col-md-8">-->
                <!--<input type="text" class="form-control" id="sms-code" name="sms_code" data-explain="输入短信验证码"-->
                <!--required="required" data-url="/edu_cloud/sms_check/sms_forget_password" aria-required="true">-->
                <!--</div>-->
                <!--<div class="col-md-4">-->
                <!--<a class="btn btn-default btn-sm js-sms-send disabled" href="javascript:"-->
                <!--data-sms-url="/edu_cloud/sms_send" data-sms-type="sms_forget_password">-->
                <!--<span id="js-time-left"></span>-->
                <!--<span id="js-fetch-btn-text">获取验证码</span>-->
                <!--</a>-->
                <!--</div>-->
                <!--<div class="col-md-12 help-block"></div>-->
                <!--</div>-->
                <!--</div>-->

                <!--<div class="form-group">-->
                <!--<div class="controls">-->
                <!--<button type="button" class="btn btn-primary" data-loading-text="正在提交...">重设密码</button>-->
                <!--</div>-->
                <!--</div>-->
                <!--</form>-->
            </div><!-- /panel -->
        </div>
    </div>
</div>
<script>
    // $('li[class*="js-find-by-"]').on('click', function (e) {
    //     if ($(this).hasClass('js-find-by-email')) {
    //         $('.js-find-by-email').addClass('active');
    //         $('.js-find-by-mobile').removeClass('active');
    //         $('#password-reset-form').removeClass('hide');
    //         $('#password-reset-by-mobile-form').addClass('hide');
    //     } else {
    //         $('.js-find-by-mobile').addClass('active');
    //         $('.js-find-by-email').removeClass('active');
    //         $('#password-reset-form').addClass('hide');
    //         $('#password-reset-by-mobile-form').removeClass('hide');
    //     }
    // });
    var vm = new Vue({
        el: '#password-reset-form',
        data: {
            user: {
                username:null,
                email: null,
            },
            msg:null,
        },
        methods: {
            find_: function () {
                $.post("/user/findpass", this.user, function (data) {
                    if (data.success) {
                        alert('更改成功！点击跳转登录...');
                        location.href = "/login";
                    }
                    else {
                        layer.msg(data.msg,{icon:5});

                    }
                });
            },
        }
    });
</script>
#include('footer.html')
